package controller;

import util.JdbcUtils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *   @Description
 *   @author 高杰  gao4433@qq.com   
 *   @date 2021/12/14 16:54
 *   @since 1.8
 */
public class UserDeleteServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        String sql = "DELETE FROM `user` WHERE `id` = ? AND `disabled` = 1";
        JdbcUtils.modify(sql,id);
        response.sendRedirect("/user-list.jsp");
    }
}
